22. Quiz: Clean (Code 2)
Clean: Code 2
Clean: Code 2
Quiz
Standardize all StartDate entries with phrases similar to 'ASAP' using pandas'
replace
method within a for loop. All phrases similar to 'ASAP' are provided to you in the
asap_list
variable. Here is the
replace
documentation
for reference.
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: jupyter
- Opened files (when workspace is loaded): n/a
Quiz: for Loop Heading
QUESTION:
Get your code to work in the Jupyter Notebook above, then fill in the for loop "heading only" to standardize the 'ASAP'-related StartDate entries.
SOLUTION:
NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer
Quiz: Replace
QUIZ QUESTION: :
Assume the for loop heading is structured as follows:
for phrase in asap_list:
and the body is structured as follows (with question marks as placeholders for arguments):
df_clean.replace(to_replace=?, value=?, inplace=True)
Match the to_replace and value parameters to the appropriate arguments to standardize the 'ASAP'-related StartDate entries.
ANSWER CHOICES:
Parameter |
Argument |
---|---|
phrase |
|
asap_list |
|
'ASAP' |
SOLUTION:
Parameter |
Argument |
---|---|
phrase |
|
'ASAP' |
Solution
Clean: Code 2 Solution